VERSION 5.00
Object = "{FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.1#0"; "COMCT232.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Speciation 
   Caption         =   "Speciation"
   ClientHeight    =   6735
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6405
   LinkTopic       =   "Form2"
   ScaleHeight     =   6735
   ScaleWidth      =   6405
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox ForkInterval 
      Alignment       =   1  'Right Justify
      Height          =   285
      IMEMode         =   3  'DISABLE
      Left            =   4200
      TabIndex        =   18
      Text            =   "1000"
      Top             =   480
      Width           =   690
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3480
      TabIndex        =   12
      Top             =   6240
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "Speciation Basis"
      Height          =   3855
      Left            =   120
      TabIndex        =   3
      Top             =   1320
      Width           =   6135
      Begin MSComctlLib.Slider GeneticDistanceSlider 
         Height          =   495
         Left            =   120
         TabIndex        =   4
         Top             =   600
         Width           =   5775
         _ExtentX        =   10186
         _ExtentY        =   873
         _Version        =   393216
         LargeChange     =   100
         Min             =   10
         Max             =   1000
         SelStart        =   10
         TickStyle       =   1
         TickFrequency   =   20
         Value           =   10
      End
      Begin MSComctlLib.Slider GenerationalDistanceSlider 
         Height          =   495
         Left            =   120
         TabIndex        =   8
         ToolTipText     =   "Maximum bot velocity"
         Top             =   1920
         Width           =   5775
         _ExtentX        =   10186
         _ExtentY        =   873
         _Version        =   393216
         LargeChange     =   100
         Min             =   10
         Max             =   1000
         SelStart        =   10
         TickStyle       =   1
         TickFrequency   =   20
         Value           =   10
      End
      Begin MSComctlLib.Slider SpeciationPopulationSlider 
         Height          =   495
         Left            =   120
         TabIndex        =   14
         ToolTipText     =   "Maximum bot velocity"
         Top             =   3120
         Width           =   5775
         _ExtentX        =   10186
         _ExtentY        =   873
         _Version        =   393216
         LargeChange     =   100
         Min             =   10
         Max             =   1000
         SelStart        =   10
         TickStyle       =   1
         TickFrequency   =   20
         Value           =   10
      End
      Begin VB.Label Label7 
         Caption         =   "Minimum Population"
         Height          =   255
         Left            =   2160
         TabIndex        =   17
         Top             =   2880
         Width           =   1815
      End
      Begin VB.Label Label6 
         Caption         =   "Large"
         Height          =   255
         Left            =   5400
         TabIndex        =   16
         Top             =   2880
         Width           =   495
      End
      Begin VB.Label Label5 
         Caption         =   "Small"
         Height          =   255
         Left            =   240
         TabIndex        =   15
         Top             =   2880
         Width           =   615
      End
      Begin VB.Label Label3 
         Caption         =   "Maximum Generational Distance"
         Height          =   255
         Left            =   1800
         TabIndex        =   11
         Top             =   1680
         Width           =   2535
      End
      Begin VB.Label Label2 
         Caption         =   "Small"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   1680
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "Large"
         Height          =   255
         Left            =   5400
         TabIndex        =   9
         Top             =   1680
         Width           =   495
      End
      Begin VB.Label Label12 
         Caption         =   "Maximum Genetic Distance"
         Height          =   255
         Left            =   1920
         TabIndex        =   7
         Top             =   360
         Width           =   2775
      End
      Begin VB.Label Label37 
         Caption         =   "Small"
         Height          =   255
         Left            =   240
         TabIndex        =   6
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label38 
         Caption         =   "Large"
         Height          =   255
         Left            =   5400
         TabIndex        =   5
         Top             =   360
         Width           =   495
      End
   End
   Begin VB.CommandButton ForkSpeciesButton 
      Caption         =   "Fork Species Now"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   6240
      Width           =   1935
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "OK"
      Height          =   375
      Left            =   4920
      TabIndex        =   1
      Top             =   6240
      Width           =   1215
   End
   Begin VB.CheckBox EnableAutoSpeciation 
      Caption         =   "Fork species automatically as conditions are met"
      Height          =   615
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   2775
   End
   Begin ComCtl2.UpDown UpDown3 
      Height          =   285
      Left            =   4920
      TabIndex        =   19
      ToolTipText     =   "Initial energy assigned to this type"
      Top             =   480
      Width           =   255
      _ExtentX        =   450
      _ExtentY        =   503
      _Version        =   327681
      Value           =   1000
      AutoBuddy       =   -1  'True
      BuddyControl    =   "ForkInterval"
      BuddyDispid     =   196627
      OrigLeft        =   4920
      OrigTop         =   480
      OrigRight       =   5160
      OrigBottom      =   765
      Increment       =   500
      Max             =   32000
      Min             =   1000
      SyncBuddy       =   -1  'True
      BuddyProperty   =   0
      Enabled         =   -1  'True
   End
   Begin VB.Label Label9 
      Caption         =   "cycles"
      Height          =   255
      Left            =   5280
      TabIndex        =   21
      Tag             =   "2012"
      Top             =   480
      Width           =   1095
   End
   Begin VB.Label Label8 
      Caption         =   "Check Every"
      Height          =   255
      Left            =   3240
      TabIndex        =   20
      Tag             =   "2012"
      Top             =   480
      Width           =   1095
   End
   Begin VB.Label Label4 
      Caption         =   $"Speciation.frx":0000
      Height          =   615
      Left            =   120
      TabIndex        =   13
      Top             =   5400
      Width           =   5775
   End
End
Attribute VB_Name = "Speciation"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub CancelButton_Click()
  Unload Me
End Sub

Private Sub EnableAutoSpeciation_Click()
  ForkInterval.Enabled = EnableAutoSpeciation.value
  UpDown3.Enabled = EnableAutoSpeciation.value
End Sub

Private Sub ForkSpeciesButton_Click()
  ForkSpecies GeneticDistanceSlider.value, GenerationalDistanceSlider.value, SpeciationPopulationSlider.value
End Sub

Private Sub Form_Load()
  EnableAutoSpeciation.value = SimOpts.EnableAutoSpeciation * True
  GeneticDistanceSlider.value = CInt(SimOpts.SpeciationGeneticDistance)
  GenerationalDistanceSlider.value = CInt(SimOpts.SpeciationGenerationalDistance)
  SpeciationPopulationSlider.value = CInt(SimOpts.SpeciationMinimumPopulation)
  ForkInterval.Enabled = EnableAutoSpeciation.value
  UpDown3.Enabled = EnableAutoSpeciation.value
  ForkInterval.text = Str(SimOpts.SpeciationForkInterval)
End Sub

Private Sub OKButton_Click()
  If EnableAutoSpeciation.value And (GeneticDistanceSlider.value < 100 Or GenerationalDistanceSlider.value < 100) Then
    If MsgBox("Choosing to automatically fork species when the genetic and/or generational distance is below 100 may result in species proliferation.  Do you really want to do this?", vbYesNo + vbExclamation, MBwarning) = vbNo Then
      Exit Sub
    End If
  End If
  SimOpts.EnableAutoSpeciation = EnableAutoSpeciation.value
  SimOpts.SpeciationGeneticDistance = GeneticDistanceSlider.value
  SimOpts.SpeciationGenerationalDistance = GenerationalDistanceSlider.value
  SimOpts.SpeciationMinimumPopulation = SpeciationPopulationSlider.value
  SimOpts.SpeciationForkInterval = CLng(ForkInterval.text)
  Unload Me
End Sub


